﻿using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Markup;

namespace Gmantis.Controls.Chart
{
    [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), ContentProperty("Subtypes")]
    public class ChartTypeInfo
    {
        // Fields
        private string _name;
        private List<ChartSubtype> _stypes;

        // Methods
        public ChartTypeInfo()
        {
            this._stypes = new List<ChartSubtype>();
        }

        internal ChartTypeInfo(string name)
        {
            this._stypes = new List<ChartSubtype>();
            this._name = name;
        }

        // Properties
        public ChartSubtype this[string name]
        {
            get
            {
                foreach (ChartSubtype subtype in this.Subtypes)
                {
                    if (subtype.Name == name)
                    {
                        return subtype;
                    }
                }
                return null;
            }
        }

        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                this._name = value;
            }
        }

        public List<ChartSubtype> Subtypes
        {
            get
            {
                return this._stypes;
            }
        }
    }
}
